package string;
/*
       String substring(int starIndex): 从startIndex开始截取字符串到结尾,生成新的字符串对象
       String substring(int beginIndex, int endIndex) : 从startIndex开始截取字符串到endIndex结束,生成新的字符串对象 > [beginIndex,endIndex)
 */

public class StringDemo6 {
    public static void main(String[] args) {
        String str = "HelloWorld";


        String substring1 = str.substring(5);
        System.out.println("substring1 = " + substring1);//World
        System.out.println("str = " + str);

        //oWo
        String substring2 = str.substring(4, 7);
        System.out.println("substring2 = " + substring2);
    }
}
